Skip to content

Add support for dormakaba dKey locks#87501

Merged
MartinHjelmare merged 14 commits into
devfrom
dormakaba_dkey_mvp
Feb 12, 2023
Merged

Add support for dormakaba dKey locks#87501
MartinHjelmare merged 14 commits into
devfrom
dormakaba_dkey_mvp

Conversation

@emontnemery
Copy link
Copy Markdown
Contributor

@emontnemery emontnemery commented Feb 5, 2023

Proposed change

Add support for dormakaba dKey locks

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

Comment thread homeassistant/components/dormakaba_dkey/__init__.py Outdated
Comment thread homeassistant/components/dormakaba_dkey/__init__.py Outdated
Comment thread homeassistant/components/dormakaba_dkey/__init__.py Outdated
Comment thread homeassistant/components/dormakaba_dkey/strings.json Outdated
Comment thread homeassistant/components/dormakaba_dkey/strings.json Outdated
Comment thread homeassistant/components/dormakaba_dkey/manifest.json Outdated
Comment thread homeassistant/components/dormakaba_dkey/manifest.json Outdated
Comment thread homeassistant/components/dormakaba_dkey/models.py Outdated
Comment thread tests/components/dormakaba_dkey/test_config_flow.py
Comment thread homeassistant/components/dormakaba_dkey/config_flow.py
Comment thread homeassistant/components/dormakaba_dkey/config_flow.py Outdated
Comment thread homeassistant/components/dormakaba_dkey/config_flow.py Outdated
Comment thread tests/components/dormakaba_dkey/test_config_flow.py
Comment thread homeassistant/components/dormakaba_dkey/const.py Outdated
@home-assistant home-assistant Bot marked this pull request as draft February 9, 2023 11:19
@home-assistant
Copy link
Copy Markdown
Contributor

home-assistant Bot commented Feb 9, 2023

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

Comment thread homeassistant/components/dormakaba_dkey/config_flow.py Outdated
@emontnemery emontnemery marked this pull request as ready for review February 9, 2023 20:20
Copy link
Copy Markdown
Member

@Kane610 Kane610 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know much about the bluetooth layers but the general implementation looks good!

async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
data: DormakabaDkeyData = hass.data[DOMAIN].pop(entry.entry_id)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Observation: The naming throws me off here, data I would expect be some data description, not a class with connection properties.

Copy link
Copy Markdown
Contributor Author

@emontnemery emontnemery Feb 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class is a container of data which the integration stores in hass.data[], what would be a better name?
Maybe DkeyConfigEntryData?

Comment thread homeassistant/components/dormakaba_dkey/__init__.py Outdated
"""
if self._async_in_progress(include_uninitialized=True):
return self.async_abort(reason="no_additional_devices_found")
return self.async_abort(reason="no_devices_found")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the discovery hasn't run yet? Then we should be able to force a discovery here, I think.

I don't think it's helpful for the user to just abort their effort to add the integration.

Copy link
Copy Markdown
Contributor Author

@emontnemery emontnemery Feb 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no way to force a Bluetooth discovery, it runs continuously in the background.

I do agree the UX is not great, and I think that should be handled by improving the "add integration" dialog for bluetooth integrations which rely on Home Assistant's bluetooth discovery filter.

It could for example be updated so it shows a spinner + a text saying "Looking for compatible bluetooth devices", with the list of matching discovery flows updating while the dialog is open.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I re-added the user flow for now so this integration is similar to other bluetooth integrations.

This reverts commit 0ef9d1c.
@MartinHjelmare MartinHjelmare merged commit 4db4081 into dev Feb 12, 2023
@MartinHjelmare MartinHjelmare deleted the dormakaba_dkey_mvp branch February 12, 2023 12:46
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants